package com.zzyy.study.service.impl;

import com.zzyy.study.entities.User;
import com.zzyy.study.exp.BusinessException;
import com.zzyy.study.mapper.UserMapper;
import com.zzyy.study.resp.ReturnCodeEnum;
import com.zzyy.study.service.UserService;
import com.zzyy.study.trace.TraceUtils;
import jakarta.annotation.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @auther zzyy
 * @create 2024-02-17 16:15
 */
@Service
public class UserServiceImpl implements UserService
{
    @Resource
    private UserMapper userMapper;

    @Override
    public int addUser(User user)
    {
        return userMapper.insertSelective(user);
    }

    @Override
    public int delUser(Integer id)
    {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateUser(User user)
    {
        return userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public User getUserById(Integer id)
    {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<User> getAll()
    {
        return userMapper.selectAll();
    }
}
